package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class LoginActivity extends AppCompatActivity {
    private EditText pwd,phone;
    String account,password;
    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        pwd=findViewById(R.id.pwd);
        phone=findViewById(R.id.phone);
        button=findViewById(R.id.next);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                password=pwd.getText().toString();
                account=phone.getText().toString();
                if (password.equals("")||account.equals("")) {
                    Toast.makeText(LoginActivity.this, "请您将信息填写完整！", Toast.LENGTH_LONG).show();
                }else if(password.length()<6||account.length()<6){
                    Toast.makeText(LoginActivity.this, "密码和账号长度在6位及以上请检查", Toast.LENGTH_LONG).show();
                }else{
                    Intent intent=new Intent();
                    intent.setClass(LoginActivity.this,HomeActivity.class);
                    startActivity(intent);

                }
            }
        });

    }


}
